home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / qic02_11.zip / QIC02.H < prev    next >
Text File  |  1993-05-03  |  5KB  |  119 lines

  1. /*
  2.  * qic02.h - qic02 stuff definitions
  3.  *
  4.  * This program is free software; you can redistribute it and/or modify
  5.  * it under the terms of the GNU General Public License as published by
  6.  * the Free Software Foundation; either version 2 of the License, or (at
  7.  * your option) any later version.
  8.  *
  9.  * This program is distributed in the hope that it will be useful, but
  10.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.  * General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this library; if not, write to the Free Software
  16.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  *
  18.  */
  19.  
  20. /* controller I/O ports */
  21. #define BASE    iobase        /* base of controller registers */
  22. #define DATA    BASE        /* data register (read/write) */
  23. #define CONTROL BASE+1        /* control register (write) */
  24. #define STATUS  BASE+1        /* status register (read) */
  25. #define DMAGO   BASE+2        /* start DMA (dummy write) */
  26. #define RSTDMA  BASE+3        /* reset DMA logic (dummy write) */
  27.  
  28. /* control register bits */
  29. #define RSTSAC  0x80        /* reset SAC */
  30. #define REQ     0x40        /* request to LSI chip */
  31. #define IEN     0x20        /* global interrupt enable */
  32. #define DNIEN   0x10        /* done interrupt enable */
  33.  
  34. /* status register bits */
  35. #define IRQF    0x80        /* interrupt request flag */
  36. #define RDY     0x40        /* ready from LSI chip (active LOW) */
  37. #define EXC     0x20        /* exception from LSI chip (active LOW) */
  38. #define DONE    0x10        /* DMA logic done (active LOW) */
  39. #define DIRC    0x08        /* direction from LSI chip (1=to controller) */
  40.  
  41. #define RDYEXC_MASK 0x60
  42.  
  43. /* exception positions */
  44. #define FIL     0x01        /* File mark detected */
  45. #define BNL     0x02        /* Block not located */
  46. #define UDE     0x04        /* Unrecoverable data error */
  47. #define EOM     0x08        /* End of medium */
  48. #define WRP     0x10        /* Write protected cartridge */
  49. #define DFF     0x20        /* Device fault or SELF TEST failed */
  50. #define CNI     0x40        /* Cartridge not in place */
  51. #define ST0     0x80        /* Flag(s) set in this byte (0) */
  52.  
  53. #define POR     0x01        /* Power on or RESET occurred */
  54. #define EOD     0x02        /* End of recorded data */
  55. #define PAR     0x04        /* Bus parity error */
  56. #define BOM     0x08        /* Beginning of medium */
  57. #define MBD     0x10        /* Marginal block detected */
  58. #define NDT     0x20        /* No data detected */
  59. #define ILL     0x40        /* Illegal command */
  60. #define ST1     0x80        /* Flag(s) set in this byte (1) */
  61.  
  62. /* common exception causes */
  63. #define CNIerr  1        /* no cartridge */
  64. #define WRPerr  2        /* write protected */
  65. #define EOMerr  3        /* end of media */
  66. #define RWAerr  4        /* read / write abort */
  67. #define RBBerr  5        /* read error, bad block xfer */
  68. #define RFBerr  6        /* read error, filler block xfer */
  69. #define EODerr  7        /* end of data */
  70. #define EDMerr  8        /* end of data & EOM */
  71. #define RFMerr  9        /* read a filemark */
  72. #define ILLerr  10        /* illegal command */
  73. #define PORerr  11        /* power on / reset */
  74. #define MARerr  12        /* marginal block detected */
  75. #define PARerr  13        /* bus parity error detected */
  76. #define THCerr  14        /* throughcheck error detected */
  77. #define DEADerr 15        /* Device dead, read status failed */
  78.  
  79. /* FATAL error, tape drive must be dead */
  80. #define DEADerr 15        /* drive dead, even read status fails */
  81.  
  82. /* standard QIC02 commands */
  83. #define BOT        0x21        /* Position to beginning of tape (rewind) */
  84. #define ERASE      0x22        /* Erase tape */
  85. #define RETENSION  0x24        /* Re-tension tape */
  86. #define WRITE      0x40        /* Write to tape */
  87. #define WRMARK     0x60        /* Write file mark to tape */
  88. #define READ       0x80        /* Read from tape */
  89. #define RDMARK     0xa0        /* Read file mark from tape */
  90. #define RDSTATUS   0xc0        /* Read status from tape drive */
  91.  
  92. /* optional QIC02 commands */
  93. #define SPACEFORW  0x81        /* Space forward */
  94. #define SPACEREV   0x89        /* Space reverse */
  95. #define SEEKEOD    0xa3        /* Seek to End Of Data */
  96.  
  97. /* Vendor unique (2150L) QIC02 commands */
  98. #define SETQIC24   0x27        /* Set device format QIC-24 */
  99. #define SETQIC120  0x28        /* Set device format QIC-120 */
  100. #define SETQIC150  0x29        /* Set device format QIC-150 */
  101. #define SEEKBLK    0xad        /* Seek block N */
  102. #define RDBLKADDR  0xae        /* Read block address */
  103. #define RDRESCNT   0xc8        /* Read residual block count */
  104.  
  105. /* usefull abrv. */
  106. #define setreq        outportb(CONTROL, REQ)
  107. #define resetreq      outportb(CONTROL, 0)
  108. #define outdata(a)    outportb(DATA, (a))
  109. #define indata        inportb(DATA)
  110. #define not_rdy       (inportb(STATUS) & RDY)
  111. #define wait_rdy      while (inportb(STATUS) & RDY)
  112. #define wait_nrdy     while (!(inportb(STATUS) & RDY))
  113. #define wait_exc      while (inportb(STATUS) & EXC)
  114. #define wait_stat     while ((inportb(STATUS) & RDYEXC_MASK) == RDYEXC_MASK)
  115. #define wait_dma      while (inportb(STATUS) & DONE)
  116. #define errstat(a,b)  (statusbyte[a] & b)
  117. #define is_exception  !(inportb(STATUS) & EXC)
  118.  
  119.